-- Test with i16.^.
-- ==
--
-- input  {
--   5i64
--   [0, 1, 2, 3, 4]
--   [1i16, 1i16, 1i16, 1i16, 1i16]
-- }
-- output {
--   [1i16, 1i16, 1i16, 1i16, 1i16]
-- }
--
-- input  {
--   5i64
--   [0, 0, 0, 0, 0]
--   [6i16, 1i16, 4i16, 5i16, -1i16]
-- }
-- output {
--   [-7i16, 0i16, 0i16, 0i16, 0i16]
-- }
--
-- input  {
--   5i64
--   [1, 2, 1, 4, 5]
--   [1i16, 1i16, 4i16, 4i16, 4i16]
-- }
-- output {
--   [0i16, 5i16, 1i16, 0i16, 4i16]
-- }

def main [m] (n: i64) (is: [m]i32) (image: [m]i16) : [n]i16 =
  hist (i16.^) 0 n (map i64.i32 is) image
